declare global {
    interface Window {
        _OpenOriginal: Window['open']
        EcExtension: EcExtension
        win: any
        removePopup: (id: string) => void
    }
}

export type EcExtension = {
    open: Window['open']
    popup: (options: PopupOptions) => Window
    Menus: Menus
    ready: (callback: Function) => void
}

export type PopupOptions = {
    title: string
    view: string
    id?: string
    parentId?: string
    window?: Window
    width?: number
    height?: number
    features?: { [key: string]: string | number | boolean }
}

export type Menu = {
    id: string
    title: string
    children?: Menu[]
    onClick: () => void
}

export type MenuHandler = {
    id: string
    function: Function
}

export type Menus = {
    register: (title: string, onClick: () => void) => void
    handlers: MenuHandler[]
    root: Menu
}

export {}